from sqlalchemy import Column, Integer, String, Text, SmallInteger
from sqlalchemy.sql import func

import time
from mooc.db.database import Base


class Admin(Base):
    __tablename__ = "ims_goouc_fullexam_admin"

    id = Column(Integer, primary_key=True, autoincrement=True)
    weid = Column(String(150), nullable=False)
    username = Column(String(255), nullable=False)
    password = Column(String(255), nullable=False)
    createtime = Column(Integer, nullable=False, default=lambda: int(time.time()))
    logintime = Column(Integer, nullable=False, default=lambda: int(time.time()))
    is_delete = Column(SmallInteger, nullable=False, default=1, comment='0正常 1禁用')
    pcate_id = Column(Integer, nullable=False, comment='一级类目id')
    cate_id = Column(Integer, nullable=False, comment='二级级类目id')
    relation_id = Column(Text, nullable=False, comment='关联试卷ID')

    class Config:
        from_attributes = True

